#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
ll a[100005];
ll b[100005];
ll ans=0;
int main () {
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
//    freopen("duel4.in", "r", stdin);
    cin >> n;
    memset(b, 0, sizeof(b));
    for(ll i=1; i<=n; i++) {
        cin >> a[i];
    }
    sort(a+1, a+n+1);
    ll p=1;
    b[1]=1;

    for(ll i=2; i<=n; i++) {
        if(a[i]==a[i-1]) {
            b[i]=b[i-1];
        }
        else {
            p++;
            b[i]=p;
        }
    }
    p=1;
    for(ll i=1; i<=n; i++) {
        if(b[i]>b[p]) {
            p++;
        }
    }
    ans=(n-p+1);
    cout << ans << endl;
    return 0;
}
